﻿using Microsoft.Owin;
using Owin;
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.Cookies;

[assembly: OwinStartup(typeof(WebApiTest.Startup))]

namespace WebApiTest
{
    public partial class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            // 不能使用这种方式添加必须使用app的相应方法或者中间件实现
            // HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "*");

            //app.UseWebApi();
            //app.Use(async (context, next) => {
            //    context.Response.Headers.Set("Access-Control-Allow-Origin", "*");
            //    await next();
            //});
            app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
            app.UseCookieAuthentication(new CookieAuthenticationOptions());
        }
    }
}